<?php

use Biz\cache\brand\BlindBox as cBlindBox;
use Biz\service\brand\BlindBox;
use hhz\constant\redis\redisKeys;
use Hhz\Redis\otherRedis;

/**
 * 奖品列表
 */
class PrizeListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {
        $list = BlindBox::getPrizeList($this->uid);

        $favCount = $this->uid ? cBlindBox::getTodayFavWiki($this->uid) : 0;

//        $constKey = redisKeys::KEY_B_OTHER_BLIND_BOX_TODY_FAV_WIKI_;
//        $redis = new otherRedis($constKey);
//        $key = $constKey . $this->uid;
//        $count = $redis->get($key);
//        $favCount = $this->uid ? $count : 0;

        $this->setSuccess([
            'list' => array_values($list),
            'today_fav_wiki' => (!empty($favCount) && $favCount > 0) ? $favCount : 0
        ]);
    }
}